<?php
header("content-type:text/html;charset=utf-8");
require("config.php");												//包含数据库连接文件
$id=$_GET["id"];
$select="SELECT * FROM high_level where id='$id'";
$result=mysql_query($select);
$data = mysql_fetch_assoc($result);
?>
<html>
	<head>
	 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>所属模型</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- Bootstrap -->
    <link rel="stylesheet" href="http://cdn.bootcss.com/twitter-bootstrap/3.0.3/css/bootstrap.min.css">
	<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="http://cdn.bootcss.com/jquery/1.10.2/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="http://cdn.bootcss.com/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
	</head>
	<body>
	<block name="main">
	  <div id="page-wrapper" class="gray-bg dashbard-1">
        <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>添加分类</h5>
                </div>
                <div class="ibox-content">
                    <form class="form-horizontal m-t " method="post" action="high_level.php">
                        <input type="hidden" name='id' value="{$_GET['id']}">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">首页显示位置：</label>
                            <div class="col-sm-3">
                                <select name="layout">
                                    <option value="left"
                                        <if condition="($data['layout'] eq 'left')">selected</if> >
                                        左侧
                                    </option>
                                    <option value="bottom"
                                        <if condition="($data['layout'] eq 'bottom')">
                                        selected</if> >底部
                                    </option>
                                </select>
                            </div>
                        </div>
			<!-- 名称输入框 -->	
                        <div class="form-group">
                            <label class="col-sm-3 control-label">名称：</label>
                            <div class="col-sm-3">
                                <input  type="text" id="high_name" class="form-control"
                                        name="high_name" value="{$data['high_name']}">
                            </div>
                        </div>
			<!-- 排序输入框 -->
                        <div class="form-group">
                            <label class="col-sm-3 control-label">排序：</label>
                            <div class="col-sm-3">
                                <input  type="text" id="sort" class="form-control"
                                        name="sort" value="{$data['sort']}">
                            </div>
                        </div>
			<!-- 是否显示单选框 -->
                        <div class="form-group">
                            <label class="col-sm-3 control-label">是否显示：</label>
                            <input type="radio"  value="0"  name="is_display"
                                 <if condition="($data['is_display'] neq 1)">checked </if> />
                                否
                            <input type="radio"  value="1"  name="is_display"
                                <if condition="($data['is_display'] eq 1)">checked </if> />
                                是
                        </div>
			<!-- 提交按钮 -->
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-3">
                                <button class="btn btn-primary" type="submit">
                                    提交
                                </button>
                            </div>
                        </div>
                    </form>

                </div>
            </div>
        </div>
    </div>

<script>
    $('form').submit(function(){
        var name = $('#high_name').val();
        var sort = $("#sort").val();
        if(name == ''){
            layer.msg('请填写名称',{time:1000});
            return false;
        }
        if(!sort || isNaN(sort)){
            layer.msg('请填写排序，并且为数字',{time:1000});
            return false;
        }
    });
</script>
</block>
</body>

</html>
